<?php 

$path = $csv_link->result_xml;
if (file_exists($path)):
    $uchwyt = fopen ($path, "r");
    while (!feof ($uchwyt)) {
        $buffer = fgets($uchwyt, 4096);
        //echo $buffer;
        $ydata[] = (int)$buffer;
    }
    fclose ($uchwyt);
endif;
//var_dump($ydata);
// content="text/plain; charset=utf-8"
header('Content-type: image/png');
// Some data
//$ydata = array();

if(empty($ydata)) {echo 'brak wyników';} else {

require_once ($_SERVER["DOCUMENT_ROOT"].'/jpgraph/jpgraph.php');
require_once ($_SERVER["DOCUMENT_ROOT"].'/jpgraph/jpgraph_line.php');
require_once ($_SERVER["DOCUMENT_ROOT"].'/jpgraph/jpgraph_scatter.php');

// Size of the overall graph
$width=600;
$height=420;

// Create the graph and set a scale.
// These two calls are always required

//$ymin = '0';
//$ymax = '100';

$graph = new Graph($width,$height);
$graph->SetScale('textlin', 0, 0, 0, 0);

// Setup margin and titles
$graph->SetMargin(40,40,40,40);
$graph->title->Set('Siła wydmuchu ');
//$graph->subtitle->Set('Od: '..' Do: '.);
$graph->xaxis->title->Set('Czas');
$graph->yaxis->title->Set('Skala 0[min] - 100[max]');
// Create the linear plot
$lineplot=new LinePlot($ydata);
$lineplot->SetColor("#55bbdd");
$lineplot->value->SetFormat('%d');
$lineplot->value->Show();
$lineplot->value->SetColor('#55bbdd');
$lineplot->SetCenter();

// Add the plot to the graph
$graph->Add($lineplot);

// Display the graph
$graph->Stroke(); 

}

?>